Memory management
From Cppreference
Contents |
[edit] Allocation
The new expression is a language builtin which is the only way to initialize objects initialize objects in dynamically obtained memory. The memory is acquired by an operator new, new[] (allocation functions).
[edit] Deallocation
The delete expression is used to destruct objects previously initialized by the new expression and deallocate memory after that. For deallocation the delete expression uses operator delete, delete[] (deallocation functions).
Note, that it is possible to explicitly call the destructor of an object and deallocation function separately, if required.
[edit] Miscellaneous
The <new> header contains declarations of default allocation and deallocation functions (note that these functions are implicitly defined in each translation unit). Also several utility functions, types and objects are declared
| This section is incomplete |
Classes | |||
| exception thrown when memory allocation fails (class) | ||
| exception thrown on allocation of array with greater than implementation supported, or negative length (class) | ||
| tag type used to select an non-throwing allocation function (class) | ||
Types | |||
| function pointer type, used in set_new_handler() (class) | ||
Functions | |||
| sets a function which is called when an allocation function fails to obtain more memory to the free memory pool (function) | ||
Objects | |||
| an object of type nothrow_t used to select an non-throwing allocation function (function) | ||